package learn;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * 按字节写
 */

public class OutTest {

    public static void main(String[] args) {
        try (OutputStream outputStream = new FileOutputStream("./test.txt", true)) {
//            outputStream.write(97);
//            outputStream.write(98);
//            outputStream.write(99);

            byte[] buffer = new byte[]{100, 101, 102};
            outputStream.write(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main1(String[] args) {
        try (OutputStream outputStream = new FileOutputStream("./test.txt")) {
//            outputStream.write(97);
//            outputStream.write(98);
//            outputStream.write(99);

            byte[] buffer = new byte[]{100, 101, 102};
            outputStream.write(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
